Skip to content

feat: Playwright E2E test suite — 41 tests across feedback, student management, and print flows - #74

Merged
clates merged 20 commits into
mainfrom
feat/playwright-e2e-suite
May 30, 2026
Merged

feat: Playwright E2E test suite — 41 tests across feedback, student management, and print flows#74
clates merged 20 commits into
mainfrom
feat/playwright-e2e-suite

Conversation

@clates

@clates clates commented May 28, 2026

Copy link
Copy Markdown
Owner

Summary

  • Installs Playwright and wires a test:e2e npm script that spins up the FastAPI backend and Next.js dev server, seeds the SQLite test DB, runs 41 chromium tests, and tears down
  • Covers three feature areas: feedback modal flows (plans list, plan detail modal, feedback submission/editing/locking), student CRUD (create, edit, delete), and worksheet print route smoke tests
  • Fixes several backend/proxy bugs discovered during test authoring

What's in this PR

Test infrastructure

  • frontend/playwright.config.ts — chromium, fullyParallel, global setup/teardown, webServer (port 3002)
  • frontend/global-setup.ts — kills stale backends, reinitializes test DB, spawns fresh uvicorn
  • frontend/global-teardown.ts — kills backend process on exit
  • scripts/e2e_seed.py — CLI helpers: init_db (delete + recreate), create_packet, backdate_feedback
  • frontend/e2e/fixtures/api.tscreateStudent, createPacket, submitFeedback, backdateFeedback

Test specs (41 tests, all passing)

  • frontend/e2e/feedback.spec.ts — 33 tests: plans page empty state, pending packet card, plan detail modal (open/close/print/feedback state), feedback modal (first submission + editing)
  • frontend/e2e/students.spec.ts — 6 tests: create validation, create success, edit pre-population/rename, delete confirmation/execution
  • frontend/e2e/print.spec.ts — 2 tests: direct API response + Next.js proxy reachability

Bug fixes found during testing

  • src/main.py: WeeklyPacketSummary was missing has_feedback and feedback_completed_at fields — Pydantic filtered them out so the UI always showed "Provide Feedback" regardless of DB state
  • frontend/app/api/[...path]/route.ts: 204 No Content responses crashed the proxy (passed a body to new NextResponse with status 204) — DELETE student and feedback submit returned 502 through the UI
  • frontend/components/ui/Input.tsx: Added id/htmlFor linkage so getByLabel locators work in tests
  • frontend/components/ui/Modal.tsx: Added role="dialog" / aria-modal so getByRole('dialog') locators work

Test plan

  • npm run test:e2e from frontend/ — 41/41 passing, ~3 min
  • Verified has_feedback: true in API response after fix
  • Verified 204 proxy no longer crashes on DELETE/feedback submit
  • Two consecutive runs both pass (DB reset confirmed clean)

🤖 Generated with Claude Code

clates and others added 20 commits May 26, 2026 21:10
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
… for submission block

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
- Add has_feedback/feedback_completed_at to WeeklyPacketSummary so the
  plans page correctly shows "Edit Feedback" vs "Provide Feedback"
- Fix 204 No Content proxy crash in Next.js catch-all route
- Reset test DB on each run (delete + recreate) so stale data can't
  cause test pollution across runs
- Kill any existing backend on port 8182 before starting fresh test
  backend, preventing old code from serving tests
- Fix strict mode violations in test selectors (getByRole with exact
  match, scope Mathematics to studentCard, Close button exact match)
- Remove .catch(() => {}) on createStudent calls so failures surface
  instead of creating orphan packets without a student_profiles row
- Use unique student name in create-student test to avoid cross-run
  collisions when DB reset fails
- Add label/id linkage to Input component for getByLabel locators
- Add role=dialog/aria-modal to Modal component for getByRole locators

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Adds an e2e-tests job that runs on every PR and push to main. The job:
- Creates a Python venv and installs backend dependencies (uvicorn, etc.)
- Installs Node dependencies and Playwright's chromium browser
- Runs all 41 E2E tests via `npm run test:e2e`
- Uploads the Playwright HTML report as an artifact on failure

CI=true triggers stricter Playwright config: forbidOnly, retries=1,
reuseExistingServer=false (always starts a fresh Next.js dev server).

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@clates
clates merged commit ed43153 into main May 30, 2026
3 checks passed
@clates
clates deleted the feat/playwright-e2e-suite branch May 30, 2026 02:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant